/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.vu.demo.action;

import com.opensymphony.xwork2.ActionSupport;

import java.util.Iterator;
import java.util.List;

import net.vu.demo.bean.Employee;
import net.vu.demo.bean.EmployeeService;

/**
 *
 * @author VUHOLMES
 */
public class ListEmployeeAction extends ActionSupport {
    /** 
    * 
    */
    private static final long serialVersionUID = 1L; 
    EmployeeService service = new EmployeeService(); 
    private List<Employee> employeeList;
    
    
    public List<Employee> getEmployeeList() { 
        System.out.println("getEmployeeList() in class ListEmployeeAction"); 
        return employeeList;
    }
    
    @Override
    public String execute() throws Exception{ 
        System.out.println("execute() in class ListEmployeeAction"); 
        service.addEmployeeToList(); 
        
        employeeList = service.list();
        
//        Employee em = new Employee();
//        Iterator<Employee> it = employeeList.iterator();
//        while(it.hasNext()){
//        	em = it.next();
//        	System.out.print(em.getId() + " " + em.getName());
//            System.out.println();
//        }
        
        //em.getName();
        return SUCCESS;
    }
}
